Imports System.Net.NetworkInformation

''' <summary>
''' Network methods and utilities.
''' </summary>
Public Class NetworkUtil

#Region "Private constructor"

	Private Sub New()
		' Can't create instance!
	End Sub

#End Region

#Region "Network functions"

	''' <summary>
	''' Checks if computer has internet connection available (use Google's IP).
	''' </summary>
	''' <returns>True if connection is available, otherwise false.</returns>
	Public Shared Function IsConnected() As Boolean

		Return IsConnected("google.com")

	End Function

	''' <summary>
	''' Checks if mobile as a network available.
	''' </summary>
	''' <returns>True if network is available, otherwise false.</returns>
	Public Shared Function IsConnected(ByVal ip As String) As Boolean

		Try

			Return NetworkInterface.GetIsNetworkAvailable

		Catch

			Return False

		End Try

	End Function

#End Region

End Class